#include <cstdio>
#include <cstdlib>
#include <memory.h>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <queue>
using namespace std;
#define PI 3.14159265358979323846264338327950288
#define Eps 1E-8
int N, K;
pair <int, pair <double, int> > info[500005];
double finish[500005];
vector <int> firstK;
double cnt;
struct cmp {
   bool operator()(int a, int b) {
      return info[a].second.first / info[a].second.second > info[b].second.first / info[b].second.second + Eps;
   }
};
priority_queue <int, vector <int>, cmp> my_left;
void proc(double unt) {
   int i;
   while (cnt < unt - Eps) {
      double next = unt - cnt;
      for (i = 0; i < firstK.size(); i ++)
	 next = min(next, info[firstK[i]].second.first);
      for (i = 0; i < firstK.size(); i ++)
	 info[firstK[i]].second.first -= next;
      cnt += next;
      for (i = 0; i < firstK.size(); i ++)
	 if (info[firstK[i]].second.first < Eps) {
	    finish[firstK[i]] = cnt;
	    firstK.erase(firstK.begin() + i);
	 }
      while (!my_left.empty() && firstK.size() < K) {
	 firstK.push_back(my_left.top());
	 my_left.pop();
      }
   }
}	
int main() {
   int i, j, k, l, m;
   //freopen("download.in", "r", stdin);
   scanf("%d%d", &N, &K);
   for (i = 0; i < N; i ++) {
      scanf("%d%d%d%d", &j, &k, &l, &m);
      info[i] = make_pair(l, make_pair(double(j) / k, m));
   }
   sort(info, info + N);
   cnt = 0;
   for (i = 0; i < N; i ++) {
      proc(info[i].first);
      firstK.push_back(i);
      if (firstK.size() > K) {
	 double m1 = -1;
	 int m2;
	 for (j = 0; j < firstK.size(); j ++)
	    if (m1 < info[firstK[j]].second.first / info[firstK[j]].second.second) {
	       m1 = info[firstK[j]].second.first / info[firstK[j]].second.second;
	       m2 = j;
	    }
	 my_left.push(firstK[m2]);
	 firstK.erase(firstK.begin() + m2);
      }
   }
   proc(1E15);
   double ret = 0, ret2 = 0;
   for (i = 0; i < N; i ++) {
      ret += (finish[i] - info[i].first) * info[i].second.second;
      ret2 += info[i].second.second;
   }
   printf("%.10lf\n", ret / ret2);
   return 0;
}

